namespace Cofe.Data.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class CofeIO : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.FileInfo",
                c => new
                    {
                        Id = c.Guid(nullable: false),
                        Type = c.String(nullable: false, maxLength: 50),
                        FileAttributes = c.Int(nullable: false),
                        MD5 = c.String(),
                        Discriminator = c.String(nullable: false, maxLength: 128),
                    })
                .PrimaryKey(t => new { t.Id, t.Type })
                .ForeignKey("dbo.CofeItemInfo", t => new { t.Id, t.Type }, cascadeDelete: true)
                .Index(t => new { t.Id, t.Type });
            
            CreateTable(
                "dbo.DirectoryInfo",
                c => new
                    {
                        Id = c.Guid(nullable: false),
                        Type = c.String(nullable: false, maxLength: 50),
                        Discriminator = c.String(nullable: false, maxLength: 128),
                    })
                .PrimaryKey(t => new { t.Id, t.Type })
                .ForeignKey("dbo.CofeDirectoryInfo", t => new { t.Id, t.Type }, cascadeDelete: true)
                .Index(t => new { t.Id, t.Type });
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.DirectoryInfo", new[] { "Id", "Type" });
            DropIndex("dbo.FileInfo", new[] { "Id", "Type" });
            DropForeignKey("dbo.DirectoryInfo", new[] { "Id", "Type" }, "dbo.CofeDirectoryInfo");
            DropForeignKey("dbo.FileInfo", new[] { "Id", "Type" }, "dbo.CofeItemInfo");
            DropTable("dbo.DirectoryInfo");
            DropTable("dbo.FileInfo");
        }
    }
}
